import { request, config } from '../utils'

const { defaultPageSize } = config;

/**
 * 公共的query组件
 * @param {*} param0
 * @author lz
 */
export async function commonQuery({
  apiBaseUrl,
  interfaceName = 'list',
  limit,
  current: start = 0,
  sort,
  order,
  queryParam = {}
}) {
  const url = `${apiBaseUrl}/${interfaceName}`
  const param = {
    start: start,
    limit: limit ? limit : defaultPageSize,
    sort: sort,
    order: order,
    ...queryParam
  };
  return request({ url: url, method: 'POST', data: param })
}
